/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.ufba.lasid.v1.jitclouds.mda.examples;

import br.ufba.lasid.v1.jitclouds.mda.MDA;
import br.ufba.lasid.v1.jitclouds.mda.datatypes.ICloud;
import br.ufba.lasid.v1.jitclouds.mda.datatypes.ICluster;
import br.ufba.lasid.v1.jitclouds.mda.datatypes.IDataCenter;
import br.ufba.lasid.v1.jitclouds.mda.datatypes.virtualization.IHypervisor;
import br.ufba.lasid.v1.jitclouds.mda.datatypes.virtualization.INode;
import br.ufba.lasid.v1.jitclouds.mda.datatypes.virtualization.IVirtualMachine;

/**
 *
 * @author aliriosa
 */
public class CloudSample {
    
    public static void main(String[] args) throws Exception{
        
        MDA.startup();
                        
        ICloud cloud = MDA.createCloud();
        
        for(IDataCenter dc : cloud){
           for(ICluster c : dc){ 
               for(INode n : c){                   
                   for(IHypervisor h: n.getHypervisors()){
                       String domain = 
                               h.getID() + "." + n.getID() + "." + 
                               c.getID() + "." + dc.getID() + "." + cloud.getID();        
                       
                       for(IVirtualMachine m: h.getMachines()){
                           MDA.debug("Starting virtual machine " + m.getID() + "@" + domain);
                           m.startup();
                       }
                   }
               }
           }
        }                        
        
    }
    
}
